<template>
  <div>
    <van-nav-bar :border="false" fixed title="会员中心" left-arrow @click-left="GOback" placeholder />
    <section>
      <p class="buy_for">
        为账户<span>{{UserData.username}}</span>购买会员
      </p>
      <!-- 会员特权 -->
      <section class="vip_prerogative">
        <a href="javascript:;" class="header_style" @click="huiyuanAdd">
          <span class="header_left">会员特权</span>
          <section class="header_right">
            <span>会员说明</span>
            <van-icon name="arrow" color="#999" />
          </section>
        </a>
        <section class="vip_detail">
          <div class="vip_detail_left">
            <img src="@/assets/img/shen.jpg" alt="">
          </div>
          <div class="vip_detail_right">
            <h4>减免配送费</h4>
            <p>每月减免30单，每日可减免3单，每单最高减4元</p>
            <p>蜂鸟专送专享</p>
          </div>
        </section>
        <section class="vip_detail">
          <div class="vip_detail_left">
            <img src="@/assets/img/index1.jpg" alt="">
          </div>
          <div class="vip_detail_right">
            <h4>减免配送费</h4>
            <p>每月减免30单，每日可减免3单，每单最高减4元</p>
            <p>蜂鸟专送专享</p>
          </div>
        </section>

      </section>
      <!-- 开通会员 -->
      <section class="apply_vip">
        <div class="header_style">
          <span class="header_left">开通会员</span>
        </div>
        <section class="apply_vip_buy">
          <div class="apply_vip_buy_left">
            <span>1个月</span>
            <span> ¥20</span>
          </div>
          <div class="apply_vip_buy_right" @click="$router.push('/confirmOrder/payment')">购买</div>
        </section>
      </section>
      <!-- 兑换会员 -->
      <router-link class="header_style common_style" to="/vipcard/useCart">
        <span class="header_left">兑换会员</span>
        <section class="header_right">
          <span>使用卡号卡密</span>
          <van-icon name="arrow" color="#999" />
        </section>
      </router-link>
      <router-link class="header_style common_style" to="/vipcard/invoiceRecord">
        <span class="header_left">购买记录</span>
        <section class="header_right">
          <span>开发票</span>
          <van-icon name="arrow" color="#999" />
        </section>
      </router-link>
    </section>

  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState(['UserData'])
  },
  methods: {
    GOback() {
      this.$router.go(-1)
    },
    huiyuanAdd() {
      this.$store.dispatch('freshmanContent2')
      this.$router.push('/vipcard/vipDescription')
    }
  },
  mounted() {
    if (window.sessionStorage.getItem('user_id')) {
      this.$store.dispatch('getUser')
    }
  }
}
</script>

<style lang="less" scoped>
.vip_prerogative {
  background-color: #fff;
  padding-left: 0.7rem;
  margin-bottom: 0.5rem;
}
.header_style {
  display: flex;
  justify-content: space-between;
  background-color: #fff;
  line-height: 2rem;
  border-bottom: 1px solid #f5f5f5;
  padding-right: 0.7rem;
  .header_left {
    font-size: 0.65rem;
    color: #333;
  }
  .header_right {
    display: flex;
    align-items: center;
    span {
      font-size: 0.6rem;
      color: #999;
      margin-right: 0.2rem;
    }
  }
}
.vip_detail {
  display: flex;
  border-bottom: 1px solid #f5f5f5;
  padding: 0.8rem 0;
  .vip_detail_left {
    margin-right: 0.6rem;
    img {
      width: 1.6rem;
      height: 1.8rem;
    }
  }
  .vip_detail_right {
    h4 {
      font-size: 0.65rem;
      color: #333;
      font-weight: 400;
    }
    p {
      color: #999;
    }
  }
}
.apply_vip {
  background-color: #fff;
  padding-left: 0.7rem;
  margin-bottom: 0.5rem;
  .apply_vip_buy {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 0.7rem;
    font-size: 0.67rem;
    line-height: 2.6rem;
    .apply_vip_buy_left {
      span:nth-of-type(2) {
        font-weight: 700;
        color: #f60;
      }
    }
    .apply_vip_buy_right {
      border: 0.025rem solid #f60;
      border-radius: 0.2rem;
      line-height: 1rem;
      height: 1rem;
      width: 2.4rem;
      text-align: center;
      font-size: 0.55rem;
      color: #f60;
    }
  }
}
.common_style {
  padding: 0 0.7rem;
  margin-bottom: 0.5rem;
}
</style>